package day9;

class jiemian implements Runnable{

    @Override
    public void run() {
        System.out.println("显示歌曲界面");
    }
}

class bofang implements Runnable{

    @Override
    public void run() {
        System.out.println("播放 月亮之上");
    }
}

class jiemian2 extends Thread{
    @Override
    public void run() {
        System.out.println("显示歌曲界面");
    }
}

class bofang2 extends Thread{
    Object obj = new Object();
    @Override
    public void run() {
        synchronized (obj) {
            System.out.println("播放 月亮之上");
        }
    }
}

public class Demo4 {

    public static void main(String[] args) {
        jiemian j = new jiemian();
        bofang b = new bofang();
        Thread t = new Thread(j);
        Thread t2 = new Thread(b);
        t.start();
        t2.start();

        Thread t3 = new jiemian2();
        Thread t4 = new bofang2();
        t3.start();
        t4.start();
    }
}
